\hypertarget{matriz_8cpp_source}{\section{matriz.\-cpp}
}

\begin{DoxyCode}
00001 
00008 \textcolor{preprocessor}{#include "\hyperlink{matriz_8hpp}{matriz.hpp}"}
00009 
\hypertarget{matriz_8cpp_source_l00010}{}\hyperlink{classmatriz_a50d312ee991124bd4bcb86f78c89dc4a}{00010} \hyperlink{classmatriz_a50d312ee991124bd4bcb86f78c89dc4a}{matriz::matriz}()        \{\}
00011 
\hypertarget{matriz_8cpp_source_l00012}{}\hyperlink{classmatriz_a5f389fd6e345bdeb27c166f4fa3aacc1}{00012} \hyperlink{classmatriz_a5f389fd6e345bdeb27c166f4fa3aacc1}{matriz::~matriz}()       \{\}
00013 
\hypertarget{matriz_8cpp_source_l00014}{}\hyperlink{classmatriz_a9f46a149a1f075a5a39f479e9af2c855}{00014} \hyperlink{classmatriz_a50d312ee991124bd4bcb86f78c89dc4a}{matriz::matriz}(\textcolor{keywordtype}{int} ll, \textcolor{keywordtype}{int} cc)
00015 \{
00016     \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l} = ll;    \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c} = cc;
00017 
00018     \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}.resize(\hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c});
00019 
00020     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; i++)
00021         \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[i].resize(\hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l});
00022 \textcolor{comment}{//        A[i].set(l, 'c');}
00023 \}
00024 
\hypertarget{matriz_8cpp_source_l00029}{}\hyperlink{classmatriz_a2309e35c790572458cf5d5c006a694a8}{00029} \hyperlink{classmatriz_a50d312ee991124bd4bcb86f78c89dc4a}{matriz::matriz}(valarray <vetor> M, \textcolor{keywordtype}{int} ll, \textcolor{keywordtype}{int} cc)
00030 \{
00031     \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l} = ll;     \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c} = cc;
00032 
00033     \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}.resize(\hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c});
00034 
00035     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; i++)
00036         \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[i].resize(\hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l});
00037 
00038     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; i++)
00039         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} j = 0; j < \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l}; j++)
00040             \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[i][j] = M[j](i);
00041 \}
00042 
\hypertarget{matriz_8cpp_source_l00048}{}\hyperlink{classmatriz_adf61d16d010f607655e261781513a291}{00048} \hyperlink{classmatriz_a50d312ee991124bd4bcb86f78c89dc4a}{matriz::matriz}(valarray < valarray <double> > M, \textcolor{keywordtype}{int} ll, \textcolor{keywordtype}{int} cc)
00049 \{
00050     \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l} = ll;     \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c} = cc;
00051 
00052     \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}.resize(\hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c});
00053 
00054     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; i++)
00055         \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[i].resize(\hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l});
00056 
00057     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; i++)
00058         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} j = 0; j < \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l}; j++)
00059             \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[i][j] = M[j][i];
00060 \}
00061 
\hypertarget{matriz_8cpp_source_l00067}{}\hyperlink{classmatriz_aa753d1c7aee1575856b19aa2ff2a0855}{00067} \hyperlink{classmatriz_a50d312ee991124bd4bcb86f78c89dc4a}{matriz::matriz}(\textcolor{keyword}{const} \hyperlink{classmatriz}{matriz} &M)     \{    \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l} = M.\hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l};    \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c} = M.\hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c};    \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A} = M.\hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A};   \}
\hypertarget{matriz_8cpp_source_l00071}{}\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{00071} \textcolor{keywordtype}{int} \hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{matriz::retl}()      \{ \textcolor{keywordflow}{return} \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l}; \}
00072 
\hypertarget{matriz_8cpp_source_l00073}{}\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{00073} \textcolor{keywordtype}{int} \hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{matriz::retc}()      \{ \textcolor{keywordflow}{return} \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; \}
00074 
\hypertarget{matriz_8cpp_source_l00075}{}\hyperlink{classmatriz_aee72e67449fbcb14fa4a4ad322302f71}{00075} \textcolor{keywordtype}{void} \hyperlink{classmatriz_aee72e67449fbcb14fa4a4ad322302f71}{matriz::show}()
00076 \{
00077     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l}; i++)
00078     \{
00079         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} j = 0; j < \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; j++)
00080             \hyperlink{vetor_8hpp_ad8038912ca53f3415505004c16fa4a6d}{scout} << \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[i][j] << \textcolor{stringliteral}{"\(\backslash\)t"};
00081 
00082         cout << endl;
00083     \}
00084 \}
00085 
\hypertarget{matriz_8cpp_source_l00086}{}\hyperlink{classmatriz_a61b1114ead846d573f650de9af2364e4}{00086} \hyperlink{classvetor}{vetor} \hyperlink{classmatriz_a61b1114ead846d573f650de9af2364e4}{matriz::lin}(\textcolor{keywordtype}{int} ll)
00087 \{
00088     \textcolor{keywordtype}{int} cc = this->\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{retc}();
00089     \hyperlink{classvetor}{vetor} ret(cc,\textcolor{charliteral}{'l'});
00090 
00091     \textcolor{keywordflow}{if}((ll < 0) || (ll > \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l} - 1))
00092     \{
00093         cerr << \textcolor{stringliteral}{"Erro!  Indice da linha incompativel! \(\backslash\)n"};
00094         abort();
00095     \}
00096     \textcolor{keywordflow}{else}
00097     \{
00098         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c}; i++)
00099             ret(i) = \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[ll][i];
00100     \}
00101     \textcolor{keywordflow}{return} ret;
00102 \}
00103 
\hypertarget{matriz_8cpp_source_l00107}{}\hyperlink{classmatriz_a535724e3313c52a40be4b1fe89754278}{00107} \hyperlink{classvetor}{vetor} \hyperlink{classmatriz_a535724e3313c52a40be4b1fe89754278}{matriz::col}(\textcolor{keywordtype}{int} cc)
00108 \{
00109     \textcolor{keywordtype}{int} ll = this->\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{retl}();
00110     \hyperlink{classvetor}{vetor} ret(ll,\textcolor{charliteral}{'c'});
00111 
00112     \textcolor{keywordflow}{if}((cc < 0) || (cc > \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c} - 1))
00113     \{
00114         cerr << \textcolor{stringliteral}{"Erro!  Indice da coluna incompativel! \(\backslash\)n"};
00115         abort();
00116     \}
00117     \textcolor{keywordflow}{else}
00118     \{
00119         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l}; i++)
00120             ret(i) = \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[i][cc];
00121     \}
00122     \textcolor{keywordflow}{return} ret;
00123 \}
00124 
\hypertarget{matriz_8cpp_source_l00128}{}\hyperlink{classmatriz_a3dbde9a29c7bf987537b64c44b6d1c85}{00128} \hyperlink{classmatriz}{matriz}& \hyperlink{classmatriz_a3dbde9a29c7bf987537b64c44b6d1c85}{matriz::operator=}(\textcolor{keyword}{const} \hyperlink{classmatriz}{matriz} &M)
00129 \{
00130     \textcolor{keywordflow}{if}(\textcolor{keyword}{this} == &M)
00131     \{
00133     \}
00134     \textcolor{keywordflow}{else}
00135     \{
00136         \hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l} = M.\hyperlink{classmatriz_a00e746d6ab3a3735fa1c82ca250ed353}{l};    \hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c} = M.\hyperlink{classmatriz_ae9fd3c18c024897d096d4ab28eb0531a}{c};    \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A} = M.\hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A};
00137     \}
00138 
00139     \textcolor{keywordflow}{return} *\textcolor{keyword}{this};
00140 \}
00141 
\hypertarget{matriz_8cpp_source_l00142}{}\hyperlink{classmatriz_ad20d8a44dd9c25361416e3ba72505250}{00142} \hyperlink{classmatriz}{matriz} \hyperlink{classmatriz_ad20d8a44dd9c25361416e3ba72505250}{matriz::operator-}()  \{   \textcolor{keywordflow}{return} -1.0*(*this);    \}
00143 
\hypertarget{matriz_8cpp_source_l00144}{}\hyperlink{classmatriz_a6c80cd3c6bed9f51d835c378e1e64b77}{00144} \textcolor{keywordtype}{double}& \hyperlink{classmatriz_a6c80cd3c6bed9f51d835c378e1e64b77}{matriz::operator()}(\textcolor{keywordtype}{int} ll, \textcolor{keywordtype}{int} cc)      \{   \textcolor{keywordflow}{return} \hyperlink{classmatriz_aca58a80a660ff5cddec5ccf1528f9fa9}{A}[ll][cc];    \}
00145 
\hypertarget{matriz_8cpp_source_l00146}{}\hyperlink{matriz_8hpp_a5aa35bbcacb5c280e0d6f300430370ea}{00146} \hyperlink{classmatriz}{matriz} \hyperlink{matriz_8cpp_a3544289b62615aa0f3e86edfe7f9d376}{operator*}(\textcolor{keywordtype}{double} k, \hyperlink{classmatriz}{matriz} M)
00147 \{
00148     \textcolor{keywordtype}{int} ll = M.\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{retl}();
00149     \textcolor{keywordtype}{int} cc = M.\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{retc}();
00150     \hyperlink{classmatriz}{matriz} ret(ll, cc);
00151 
00152     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < ll; i++)
00153         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} j = 0; j < cc; j++)
00154         ret(i,j) = k*M(i,j);
00155 
00156     \textcolor{keywordflow}{return} ret;
00157 \}
00158 
\hypertarget{matriz_8cpp_source_l00159}{}\hyperlink{matriz_8hpp_a64ff7770ab2aec1d23fefe5c9463053f}{00159} \hyperlink{classmatriz}{matriz} \hyperlink{matriz_8cpp_a3544289b62615aa0f3e86edfe7f9d376}{operator*}(\hyperlink{classmatriz}{matriz} M, \textcolor{keywordtype}{double} k)    \{   \textcolor{keywordflow}{return} k*M;     \}
00160 
\hypertarget{matriz_8cpp_source_l00164}{}\hyperlink{matriz_8hpp_a4fcfeb5b2eda756a44cd53d46dfc4080}{00164} \hyperlink{classmatriz}{matriz} \hyperlink{matriz_8cpp_a3544289b62615aa0f3e86edfe7f9d376}{operator*}(\hyperlink{classmatriz}{matriz} B, \hyperlink{classmatriz}{matriz} C)
00165 \{
00166     \textcolor{keywordtype}{int} lb, cb, lc, cc;
00167 
00168     lb = B.\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{retl}();      cb = B.\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{retc}();
00169     lc = C.\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{retl}();      cc = C.\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{retc}();
00170 
00171     \hyperlink{classmatriz}{matriz} ret(lb, cc);
00172 
00173     \textcolor{keywordflow}{if}(cb != lc)
00174     \{
00175         cerr << \textcolor{stringliteral}{"Erro! Dimensoes invalidas! \(\backslash\)n"};
00176         abort();
00177     \}
00178     \textcolor{keywordflow}{else}
00179     \{
00180         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < lb; i++)
00181             \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} j = 0; j < cc; j++)
00182                 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} k = 0; k < lb; k++)
00183                     ret(i,j) += B(i,k)*C(k,j);
00184     \}
00185 
00186     \textcolor{keywordflow}{return} ret;
00187 \}
00188 
\hypertarget{matriz_8cpp_source_l00189}{}\hyperlink{matriz_8hpp_a5d6ef91c6c08ccb5ebbcf51509c88077}{00189} \hyperlink{classmatriz}{matriz} \hyperlink{matriz_8cpp_aa97cca9aeb4363cc45c3c086d9f326da}{operator+}(\hyperlink{classmatriz}{matriz} A, \hyperlink{classmatriz}{matriz} B)
00190 \{
00191     \textcolor{keywordtype}{int} ll, cc;
00192     ll = A.\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{retl}();
00193     cc = B.\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{retc}();
00194     \hyperlink{classmatriz}{matriz} ret(ll, cc);
00195 
00196     \textcolor{keywordflow}{if}((A.\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{retl}() != B.\hyperlink{classmatriz_a617a5bebd89b9398754aaa5a7812a823}{retl}()) || (A.\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{retc}() != B.\hyperlink{classmatriz_ae5a5c0e41f9f1e8957b778bbe55b3347}{retc}()))
00197     \{
00198         cerr << \textcolor{stringliteral}{"Erro! Dimensões incompatíveis! \(\backslash\)n"};
00199         abort();
00200     \}
00201     \textcolor{keywordflow}{else}
00202     \{
00203         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} i = 0; i < ll; i++)
00204             \textcolor{keywordflow}{for}(\textcolor{keywordtype}{signed} \textcolor{keywordtype}{int} j = 0; j < cc; j++)
00205                 ret(i,j) = A(i,j) + B(i,j);
00206     \}
00207 
00208     \textcolor{keywordflow}{return} ret;
00209 \}
00210 
\hypertarget{matriz_8cpp_source_l00211}{}\hyperlink{matriz_8hpp_a00b42bdc3f37f345d51d8bfe637050ee}{00211} \hyperlink{classmatriz}{matriz} \hyperlink{matriz_8cpp_ab2076375dc2569575f42deefca914361}{operator-}(\hyperlink{classmatriz}{matriz} A, \hyperlink{classmatriz}{matriz} B)    \{   \textcolor{keywordflow}{return} A + (-B);    \}
\end{DoxyCode}
